
<template>
  <div class="content-wrapper">
    <!-- <div class="content-header"></div>
       <div class="title">
      <div>文档培训</div>
    </div>
     <el-divider></el-divider> -->
    <div class="content-container">
      <el-table v-loading="listLoading" :data="list" highlight-current-row>
        <el-table-column
          label="流程类型"
          prop="flowTypeName"
          width="120px"
          sortable
        />
        <el-table-column label="文件编号" prop="documentCode" min-width="220" />
        <el-table-column
          label="文件名称"
          prop="documentName"
          min-width="180px"
          show-overflow-tooltip
        />
        <el-table-column
          label="申请原因"
          prop="reason"
          show-overflow-tooltip
          min-width="200px"
        />
        <el-table-column
          label="发起时间"
          prop="accessTimeString"
          width="160px"
        />
        <el-table-column
          label="操作"
          align="center"
          width="150px"
          fixed="right"
        >
          <template slot-scope="scope">
            <el-dropdown trigger="click" class="filter-item">
              <el-button type="text" class="el-icon-more" />
              <el-dropdown-menu slot="dropdown" class="user-dropdown">
                <el-dropdown-item @click.native="createTrain(scope.row)"
                  >发起培训</el-dropdown-item
                >
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>
      <!-- <pagination
        v-show="total > 0"
        :total="total"
        :page-number.sync="listQuery.pageNumber"
        :page-size.sync="listQuery.pageSize"
        @pagination="getList"
      /> -->
    </div>
  </div>
</template>

<script>
// import Pagination from '@/components/Pagination'
import { listTrainByDocumentFlow } from '@/api/xd/flow/flow_new'

export default {
  // components: { Pagination },
  data() {
    return {
      statusOptions: [],
      listQuery: {
        // pageNumber: 1,
        // pageIndex: 0,
        // pageSize: 20,
        flowTypeList: [1, 2],
        phase: 'release',
        trainFlag: true,
        trainCheckStatus: 0,
        withBatchSubFile: true
      },
      listLoading: false,
      list: [{}],
      total: 0
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      // this.listQuery.pageIndex = this.listQuery.pageNumber - 1
      listTrainByDocumentFlow(this.listQuery)
        .then((res) => {
          this.list = res.data
          // this.total = res.data.total
        })
        .finally(() => {
          this.listLoading = false
        })
    },
    handleFilter() {
      // this.listQuery.pageNumber = 1
      this.getList()
    },
    createTrain(row) {
      const data = {
        trainerUserId: row.trainerUserId,
        documentId: row.documentId,
        trainerUserName: row.trainerUserName,
        documentName: row.documentName,
        type: 1,
        documentFlowId: row.documentFlowId
      }
      this.$router.push({
        name: 'train_new',
        query: { data: JSON.stringify(data), TYPE: 'TX' }
      })
    }
  }
}
</script>
